function deepClone(source){
    let cloneObject = source.constructor === Array? []:{};
    for (let keys in source) {
        if (source[keys].hasOwnProperty(keys)) {
            if (source[keys] && typeof source[keys] === 'object') {
                cloneObject = source[keys].constructor === Array ? [] : {}
                cloneObject = deepClone(deepObject)
            }else{
                cloneObject[keys] = source[keys]
            }
        }
        return cloneObject
    }
}

function quickSort(arr) {
    if (arr,length<=1) {
        return arr
    }
    let midIndex = Math.floor((arr.length - 1)/2);
    let midValue = arr.splice(midIndex,1)[0];
    let left = []
    let right = []
    for (let i = 0; i < arr.length - 1; i++) {
        if (arr[i] > midValue) {
            right.push(arr[i])
        }else{
            left.push(arr[i])
        }
    }
    return quickSort(left).concat([midValue],quickSort(right))
}

function maopao(arr) {
    let len = arr.length - 1;
    let temp,flag
    for (let i = 0; i < len; i++) {
        flag = false
        for(let j = 0; j< len-j; j++){
            if (arr[j] > arr[j+1]) {
                temp = arr[j+1]
                arr[j+1] = arr[j]
                arr[j] = temp
                flag = true
            }
        }
        if (!flag) {
            break
        }
    }
    return arr
}